#!/bin/sh

# build fuzzers to be used with clang's libFuzzer

export CC=clang-6.0
export CFLAGS="-O1 -g -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined,integer,nullability -fsanitize=address -fsanitize-address-use-after-scope -fsanitize-coverage=trace-pc-guard,trace-cmp"
export LIB_FUZZING_ENGINE="-lFuzzer -lstdc++"
./configure --enable-fuzzing --disable-doc --disable-manywarnings
make clean
make -j$(nproc)

echo
echo "Now cd into 'fuzz/' and start fuzzing with"
echo "   e.g. './run-clang.sh libwget_atom_url_fuzzer'"
echo "To stop a fuzzer press ctrl-c"
